#include "TankController.h"
#include "TankBase.h"

CTankController::CTankController(CTankBase *tank)
:m_Tank(tank)
{

}
bool CTankController::doEvent(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  if (uMsg == WM_KEYDOWN)
  {
    switch(wParam)
    {
    case VK_LEFT:
      m_Tank->movement(TANK_DIR_LEFT);
	  m_Tank->setPosition();
      return true;
    case VK_RIGHT:
      m_Tank->movement(TANK_DIR_RIGHT);
	  m_Tank->setPosition();
      return true;
    case VK_UP:
      m_Tank->movement(TANK_DIR_FORWARD);
	  m_Tank->setPosition();
      return true;
    case VK_DOWN:
      m_Tank->movement(TANK_DIR_BACKWARD);
	  m_Tank->setPosition();
      return true;
    default:
      break;
    }
  }
  return false;
}